package com.itheima.vo;


import cn.hutool.core.bean.BeanUtil;
import com.itheima.domain.db.UserInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ShowUserVo{

    private Long id;//编号
    private String avatar;//头像
    private String nickname;//昵称
    private String gender;//性别
    private Integer age;//年龄
    private String[] tag;//标签

    // 设置用户信息
    public void setUserInfo(UserInfo userInfo) {
        if (userInfo != null) {
            BeanUtil.copyProperties(userInfo, this);
            if (userInfo.getTags() != null) {
                this.setTag(userInfo.getTags().split(","));
            }
        }
    }

}
